package LateReminder;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import BookDB.h2DAO;
import Loginout.UserBean;

@WebServlet("/LateReminderList")
public class  LateReminderList extends HttpServlet {
		private static final long serialVersionUID = 1L;
	       
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			

			HttpSession session = req.getSession();
			UserBean UB = (UserBean) session.getAttribute("ub");
			try{
			if (UB == null) {
				resp.sendRedirect("error.html");
			} else if (UB.vaild()) {

						List<UserBean> MailList=h2DAO.SelectReminderList();
		
						req.setAttribute("mlist", MailList);
						req.getRequestDispatcher("/LateReminder.jsp")
								.forward(req, resp);
}
					else
						{PrintWriter writer=resp.getWriter();
						writer.print("Late reminder list error!");
						}
				} catch (SQLException e) {
				
					e.printStackTrace();
				}
				
			}
			}
			
			
	


